<?php

$this->breadcrumbs=array(
	Yii::t('lng_post', 'Posts')=>array('index'),
	$model->title,
);

$this->menu=array(
	array('label'=>Yii::t('lng_post', 'List Post'), 'url'=>array('index')),
	array('label'=>Yii::t('lng_post', 'Create Post'), 'url'=>array('create')),
	array('label'=>Yii::t('lng_post', 'Update Post'), 'url'=>array('update', 'id'=>$model->id)),
	//array('label'=>Yii::t('lng_post', 'Delete Post'), 'url'=>'#', 'linkOptions'=>array('submit'=>array('delete','id'=>$model->id),'confirm'=>'Are you sure you want to delete this item?')),
	array('label'=>Yii::t('lng_post', 'Manage Post'), 'url'=>array('admin')),
);
?>

<h1><?php echo $model->title; ?></h1>

<?php $this->widget('zii.widgets.CDetailView', array(
	'data'=>$model,
	'attributes'=>array(
		'title',
		'content',
		'tags',
		array(
			'name'=>'status',
			'value'=>$post_status
		),
		array(
			'name'=>'create_time',
			'value'=>Yii::app()->dateFormatter->format('yyyy-MM-DD EEEE a hh:mm:ss', $model->create_time)
		),
		array(
				'name'=>'update_time',
				'value'=>Yii::app()->dateFormatter->format('yyyy-MM-DD EEEE a hh:mm:ss', $model->update_time)
		),
		'author.username',
	),
)); ?>

<div id="comments">
	<?php
	if ($model->commentCount >= 1) {
		?>
	<h3>
		<?php echo $model->commentCount . 'comment(s)'; ?>
	</h3>
	<?php
		$this->renderPartial ( '_comments', array (
				'post' => $model, 
				'comments' => $model->comments 
		) );
		?>
	<?php
	}
	?>
	
	<!-- leave a comment -->
	<h3><?php echo Yii::t('lng_post', 'Leave a Comment:');?></h3>
	<?php
	if (Yii::app ()->user->hasFlash ( 'commentSubmitted' )) {
		?>
	<div class="flash-success">
		<?php echo Yii::app()->user->getFlash('commentSubmitted'); ?>
	</div>
	<?php
	} 
	/**
	 * @var Comment
	 */
	$comment->unsetAttributes();
		$this->renderPartial ( '/comment/_form', array (
				'model' => $comment 
		) );
	?>
</div>